﻿using Microsoft.AspNetCore.Http;
using MiniExcelLibs.Attributes;
using SqlSugar;
using System;
using System.Collections.Generic;

namespace Qy.Scenario;

[SugarTable(DbTableName.QyAttment)]

public class Attment
{
    [SugarColumn(IsPrimaryKey = true)]
    public int Id { get; set; }
    public string Filename { get; set; }
    public string Ext { get; set; }
    public string Url { get; set; }
    public long? Size { get; set; }
    public string Source { get; set; }
    public int? Uid { get; set; }
    public DateTime? Time { get; set; }
}

public class ViewAttment
{
    public int Id { get; set; }
    [ExcelColumn(Name = "文件名")]
    public string Filename { get; set; }

    [ExcelColumn(Name = "文件类型")] 
    public string Ext { get; set; }
    [ExcelColumn(Name = "地址")]
    public string Url { get; set; }
    [ExcelColumn(Name = "尺寸KB")]
    public long Size { get; set; }
    public string Source { get; set; }
    [ExcelColumn(Name = "用户ID")]
    public int Uid { get; set; }
    [ExcelColumn(Name = "上传时间",Format = "yyyy-MM-dd HH:mm:ss")]
    public DateTime Time { get; set; }

    [ExcelColumn(Name = "上传用户")]
    public string NickName { get; set; }

    [ExcelColumn(Name = "用户部门")]
    public string DeptName { get; set; }

    [ExcelColumn(Name = "用ID")]
    public int UserId { get; set; }
}

/// <summary>
/// 查询模型
/// </summary>
public class AttmentQuery : PagerInfo
{
    public int? Uid { get; set; }
    public string NickName { get; set; }
    public bool ExportExcel { get; set; } = false;
    public DateTime? StartDate { get; set; }
    public DateTime? EndDate { get; set; }
}

public class UploadRes
{
    public string Filename { get; set; }
    public string SaveDir { get; set; }
    public string Ext { get; set; }
    public string Url { get; set; }
    public string Error { get; set; }
    public bool? Success { get; set; } = false;
}

public class UploadInfo
{
    public UpLoadConfig UpLoadConfig { get; set; }
    public string FileName { get; set; }
    public long? Size { get; set; }
    public string SaveDir { get; set; }
    public string FileExt { get; set; }
}

public class UploadDto
{
    public string SaveDir { get; set; }
    public string Type { get; set; } //attment,img
    public List<IFormFile> File { get; set; }
}
